from redis import StrictRedis
import logging

class Config(object):

    SECRET_KEY = "ASDFGHJ"

    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/project_zz12"
    SQLALCHEMY_TRACK_MODIFICATIONS = True

    # 定义类属性
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    SESSION_TYPE = "redis"

    SESSION_REDIS = StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    SESSION_USE_SIGNER = True

    SESSION_PERMANENT = False

    PERMANENT_SESSION_LIFETIME = 86400 * 2

    #     面向对象的继承

class DevelopConfig(Config):
    DEBUG = True
    LOG_LEVEL = logging.DEBUG

class ProductConfig(Config):
    DEBUG = False
    LOG_LEVEL = logging.DEBUG

class TestingConfig(Config):
    DEBUG = True

    # 使用字典去封装
config = {
    "develop": DevelopConfig,
    "product": ProductConfig,
    "testing": TestingConfig
}